package com.example.mapper;

import com.example.domain.po.Keyword;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

public interface KeywordMapper {


    @Select("select * from keyword where name like concat('%',#{name},'%')")
    List<Keyword> list(String name);

    @Insert("insert into  keyword(name,  detail, photopath) VALUES (#{name},#{detail},#{photopath})")
    void add(Keyword keyword);

    @Update("update keyword set name =#{name} ,detail=#{detail},photopath=#{photopath} where id =#{id}")
    void update(Keyword keyword);

    @Select("select id,name from keyword ")
    List<Map<String, Object>> getNameAndId();

    @Select("select * from keyword " +
            "where id=#{id}")
    Keyword getById(Integer id);
}
